package com.example.springbootdemo.service;

import com.example.springbootdemo.entity.User;
import com.example.springbootdemo.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserserviceImpl implements Userservice {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> userList() {
        return userMapper.userList();
    }

    @Override
    public boolean delete(Integer id) throws Exception {
        return userMapper.delete(id)>0;
    }

    @Override
    public boolean update(User user) throws Exception {
        return userMapper.update(user)>0;
    }

    @Override
    public User getUser(Integer id) throws Exception {
        return userMapper.getUser(id);
    }

    @Override
    public boolean insert(User user) throws Exception {
        return userMapper.insert(user)>0;
    }
}
